<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../vue.global.js"></script>
</head>
<body>
<div id="app"></div>
<script>
    const app = Vue.createApp({
        data() {
            return {
                countA: 11,
                countB: 22
            }
        },
        methods: {},
        watch: {
            countA(newValue,old){
                console.log(newValue,old);
            },
            countB(newValue,old){
                console.log(newValue,old);
            }
        },
        template: `
          <counter v-model:countA="countA" v-model:countB="countB"/>
        `
    });
    app.component('counter', {
        props: ['countA', 'countB'],
        methods: {
            addCountA() {
                this.$emit("update:countA", this.countA + 2)
            },
            addCountB() {
                this.$emit("update:countB", this.countB + 3)
            }
        },
        template: `
          <div @Click="addCountA">{{ countA }}</div>
          <div @click="addCountB">{{ countB }}</div>
        `
    })
    const vm = app.mount("#app");
</script>
</body>
</html>